package com.zhkj.txg.module.home.vm

import android.app.Application
import androidx.lifecycle.MutableLiveData
import com.zhkj.lib.base.BaseViewModel
import com.zhkj.lib.http.HttpResponse
import com.zhkj.lib.http.ViewModelSubscribeListener
import com.zhkj.lib.utils.AccountManager
import com.zhkj.lib.utils.SPUtil
import com.zhkj.txg.module.home.entity.ShopListResponse
import com.zhkj.txg.module.home.model.HomeManager

class ShopListViewModel(application: Application) : BaseViewModel(application) {
    private val homeManager: HomeManager = HomeManager()
    val shopListLiveData = MutableLiveData<HttpResponse<ShopListResponse>>()

    fun getShopList(map: Map<String, String>?): MutableLiveData<HttpResponse<ShopListResponse>> {
        val listener = object : ViewModelSubscribeListener<ShopListResponse>(shopListLiveData) {
            override fun onSuccess(resp: ShopListResponse) {
                super.onSuccess(resp)
            }
        }
        val shopList = homeManager.getShopList(map, listener)
        dispose.add(shopList)
        return shopListLiveData
    }
}